<?php

/**
 * 基础Controller
 */

namespace app\controllers;

use yii\web\Controller;
use app\models\Settings;
use Yii;

class BaseController extends Controller {

    public $siteName;
    public $siteLogo;
    public $siteSlogan;
    public $siteUrl;
    public $siteCpoyright;
    public $tongJi;

    public function __construct($id, $module) {
        parent::__construct($id, $module);
        //获取站点信息
        $this->siteName = Settings::findOne(['name' => 'site_name']);
        $this->siteLogo = Settings::findOne(['name' => 'site_logo']);
        $this->siteSlogan = Settings::findOne(['name' => 'site_slogan']);
        $this->siteUrl = Settings::findOne(['name' => 'site_url']);
        $this->siteCpoyright = Settings::findOne(['name' => 'site_cpoyright']);
        $this->tongJi = Settings::findOne(['name' => 'tongji']);

        Yii::$app->params['siteName'] = $this->siteName->value;
        Yii::$app->params['siteLogo'] = $this->siteLogo->value;
        Yii::$app->params['siteSlogan'] = $this->siteSlogan->value;
        Yii::$app->params['siteUrl'] = $this->siteUrl->value;
        Yii::$app->params['siteCpoyright'] = $this->siteCpoyright->value;
        Yii::$app->params['tongJi'] = $this->tongJi->value;
        
    }

}
